<!--{block return}-->
<div class="xk_spider" style="margin-bottom: 15px;">
<div class="sppoll"><input type="text" name="spider_url"
	id="spider_url" class="px url" x-webkit-speech="" speech=""
	value="$_GET[spider_url]" style="width: 25em" />
<button type="button" name="xunku_editor_button"
	id="xunku_editor_button" class="pn vm" style="vertical-align: top;"><em>{lang
xunku_editor_spider:editor_btn_now}</em></button>
<!--{if $iflater}-->
<button type="button" name="xunku_editor_later" id="xunku_editor_later"
	class="pn vm" style="vertical-align: top;" data-id="{$fid}"><em>{lang
xunku_editor_spider:editor_btn_later}</em></button>
<!--{/if}--> <span id="xk_loading"></span> {lang
xunku_editor_spider:editor_welcome}</div>
<div class="mtn"></div>
</div>
<!--/end gather-->                 

<script
	src="source/plugin/xunku_editor_spider/resource/js/jquery.min.js"></script>
<script
	src="source/plugin/xunku_editor_spider/resource/js/jquery.validate.min.js"></script>
<script type="text/javascript">
var jQ = jQuery.noConflict();

isURL = function(str_url) {// check url 
		/** validate string like 'aaaaa'	*/
		if (str_url.indexOf('.', 0) == -1) {
			return false;
		}
        var strRegex = "^((https|http|ftp|rtsp|mms)?://)"  
                + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?"
                + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP format URL like 199.194.52.184  
                + "|"
                + "([0-9a-z_!~*'()-]+\.)*" // domain- www.  
                + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 
                + "[a-z]{2,6})" // first level domain- .com or .museum  
                + "(:[0-9]{1,4})?" // port- :80  
                + "((/?)|" // a slash isn't required if there is no file name  
                + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";  
				//strRegex = "^[http|https]+://*.?";
        var re = new RegExp(strRegex);
        return re.test(str_url);
    }
jQ("#xunku_editor_button").click(function(){
var _url = $('spider_url').value;
if (!isURL(_url)) {
	var msg = '{lang xunku_editor_spider:editor_linkurl_error}';
	showDialog(msg, 'notice', '', '', 0, '', '', '', '', 3);
	return;
}
_url = encodeURIComponent(_url);//encode url
jQ("#xk_loading").html('<img src="' + STATICURL + 'image/common/loading.gif" alt="loading" />');
	jQ.getJSON("plugin.php?id=xunku_editor_spider:index"+"&range="+ _url +"&action=now&callback=?", function(data) {
		var _subject = data.subject;
		var _message = data.message;
		if(_message){
			switchEditor(0);
			$("subject").value= _subject;	
			$('e_textarea').value = html2bbcode(_message);
			discuzcode('svd');
			switchEditor(1);
			$("subject").focus();
			//userdataoption(0);
		}
		jQ("#xk_loading").html('');
	});
});

jQ("#xunku_editor_later").click(function(e){
	fid = jQ(this).data('id');
	window.location.href='plugin.php?id=xunku_editor_spider:index&action=later&fid='+ fid;
});
</script>
<!--{/block}-->